blob: 8713ab5a85e848ab8119c57f3bcfb13874464753 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
---
import Page from '../../layouts/BlogPost.astro';
import { getEntry } from 'astro:content';
import { formatDate } from "../../util";
const { slug } = Astro.params;
if (slug === undefined) {
throw new Error('Slug is required');
}
const entry = await getEntry('blog', slug);
if(entry === undefined) {
return Astro.redirect('/404');
}
const { Content } = await entry.render();
---
<Page title={entry.data.title} description={entry.data.description} date={formatDate(entry.data.date)}>
<main>
<a href="/blog" class="back-link">← All articles</a>
<Content />
</main>
</Page>
<style>
main {
background-color: #3B513B;
padding: 1.2em;
border-radius: 20px;
}
</style>
|